﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

using H2.NET.Controls;
using H2.NET.Business;
using H2.NET.Data.Common;

using System.IO;
using H2.NET.Data.Exceller;


namespace H2.NET.Web.Pages.SPM
{

    public partial class IcdCustomerMaster : TaskPage
    {
        #region 属性 Public

        private bool IsLoaded
        {
            get
            {
                return ViewState["IsLoaded"] == null ? false : (bool)ViewState["IsLoaded"];
            }
            set { ViewState["IsLoaded"] = value; }
        }
        private bool Status
        {
            get
            {
                return ViewState["Status"] == null ? false : (bool)ViewState["Status"];
            }
            set { ViewState["Status"] = value; }
        }
        public string Key
        {
            get
            {
                return ViewState["Key"] == null ? "" : (string)ViewState["Key"];

            }
            set { ViewState["Key"] = value; }
        }
        #endregion
        #region 事件 Page_Load(页面加载)
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!Page.IsPostBack)
            {
                INFO.Text = string.Format("<br/>表单正在被同事“{0}”抢占处理，拒绝提交！", RobUser);
                INFO.Visible = IsOverFlow;
                InitControls();
                InitDropDownList();

                #region 发起步骤
                if (TaskAPI.IsInitiate)
                {

                }
                #endregion
                #region 审批环节
                else
                {
                    #region 加载数据并显示
                    mdc_spm_IcdMustomer mdc_spm_IcdMustomer_1 = (mdc_spm_IcdMustomer.process == TaskAPI.Process & mdc_spm_IcdMustomer.incident == TaskAPI.Incident).ListFirst<mdc_spm_IcdMustomer>();
                    if (mdc_spm_IcdMustomer_1 != null)
                    {
                        ApplicationNo.Text = mdc_spm_IcdMustomer_1.ApplicationNo;
                    }
                    Vd_Creation.Checked = mdc_spm_IcdMustomer_1.Type == "1" ? true : false;
                    Vd_Deletion.Checked = mdc_spm_IcdMustomer_1.Type == "2" ? true : false;
                    Vd_Revision.Checked = mdc_spm_IcdMustomer_1.Type == "3" ? true : false;
                    BA_Customer_Code.Text = mdc_spm_IcdMustomer_1.Customer_Code;
                    DrpPriority.SelectedValue = mdc_spm_IcdMustomer_1.DrpPriority;
                    DMO_DrpPriority.SelectedValue = mdc_spm_IcdMustomer_1.DMO_DrpPriority;
                    BD_Company.SelectedValue = mdc_spm_IcdMustomer_1.Company;
                    if (!TaskAPI.IsBeginStep)
                    {
                        string company = BD_Company.SelectedItem.Text.ToString();
                        BD_Company.Items.Clear();
                        BD_Company.Items.Add(new ListItem(company, mdc_spm_IcdMustomer_1.Company));
                    }
                    BD_Sales_Organization.SelectedValue = mdc_spm_IcdMustomer_1.Sales_Organization;
                    if (!TaskAPI.IsBeginStep)
                    {
                        string Sales_Organization = BD_Sales_Organization.SelectedItem.Text.ToString();
                        BD_Sales_Organization.Items.Clear();
                        BD_Sales_Organization.Items.Add(new ListItem(Sales_Organization, mdc_spm_IcdMustomer_1.Sales_Organization));
                    }
                    BA_Distribution_Channel.Text = mdc_spm_IcdMustomer_1.Distribution_Channel;
                    BA_Division.Text = mdc_spm_IcdMustomer_1.Division;
                    BA_Description1.Text = mdc_spm_IcdMustomer_1.Description_1;
                    BA_Description2.Text = mdc_spm_IcdMustomer_1.Description_2;
                    BA_Search_Term.Text = mdc_spm_IcdMustomer_1.Search_Term_EN;
                    BA_Search_Term_CN.Text = mdc_spm_IcdMustomer_1.Search_Term_CN;
                    BA_Street_EN.Text = mdc_spm_IcdMustomer_1.Street_EN;
                    BA_Street_CN.Text = mdc_spm_IcdMustomer_1.Street_CN;
                    BA_City_EN.Text = mdc_spm_IcdMustomer_1.City_EN;
                    BA_City_CN.Text = mdc_spm_IcdMustomer_1.City_CN;
                    BD_Country.Text = mdc_spm_IcdMustomer_1.Country;
                    BD_Region.SelectedValue = mdc_spm_IcdMustomer_1.Region;
                    if (!TaskAPI.IsBeginStep)
                    {
                        string Region = BD_Region.SelectedItem.Text.ToString();
                        BD_Region.Items.Clear();
                        BD_Region.Items.Add(new ListItem(Region, mdc_spm_IcdMustomer_1.Region));

                    }
                    BA_Postal_Code.Text = mdc_spm_IcdMustomer_1.Postal_Code;
                    BA_Street4.Text = mdc_spm_IcdMustomer_1.Street4;
                    BA_Street5.Text = mdc_spm_IcdMustomer_1.Street5;
                    BA_District.Text = mdc_spm_IcdMustomer_1.District;
                    BA_Transportation_zone.Text = mdc_spm_IcdMustomer_1.Transportation_zone;
                    BA_Language.Text = mdc_spm_IcdMustomer_1.Language;
                    BA_Contact_Person.Text = mdc_spm_IcdMustomer_1.Contact_Person;
                    BA_Telephone.Text = mdc_spm_IcdMustomer_1.Telephone;
                    BA_Ext.Text = mdc_spm_IcdMustomer_1.Ext_1;
                    BA_Fax_number.Text = mdc_spm_IcdMustomer_1.Fax_number;
                    BA_Ext1.Text = mdc_spm_IcdMustomer_1.Ext_2;
                    BA_Email.Text = mdc_spm_IcdMustomer_1.Email;
                    BA_Vendor.Text = mdc_spm_IcdMustomer_1.Vendor;
                    this.BA_Trading_Partner_1.Text = mdc_spm_IcdMustomer_1.Trading_Partner_1;
                    BA_Corporate_Group.Text = mdc_spm_IcdMustomer_1.Corporate_Group;
                    BD_Industry.SelectedValue = mdc_spm_IcdMustomer_1.Industry;
                    if (!TaskAPI.IsBeginStep)
                    {
                        string Industry = BD_Industry.SelectedItem.Text.ToString();
                        BD_Industry.Items.Clear();
                        BD_Industry.Items.Add(new ListItem(Industry, mdc_spm_IcdMustomer_1.Industry));

                    }
                    BD_County_code.SelectedValue = mdc_spm_IcdMustomer_1.County_code;
                    if (!TaskAPI.IsBeginStep)
                    {
                        string County_code = BD_County_code.SelectedItem.Text.ToString();
                        BD_County_code.Items.Clear();
                        BD_County_code.Items.Add(new ListItem(County_code, mdc_spm_IcdMustomer_1.County_code));

                    }
                    BD_City_code.SelectedValue = mdc_spm_IcdMustomer_1.City_code;
                    if (!TaskAPI.IsBeginStep)
                    {
                        string City_code = BD_City_code.SelectedItem.Text.ToString();
                        BD_City_code.Items.Clear();
                        BD_City_code.Items.Add(new ListItem(City_code, mdc_spm_IcdMustomer_1.City_code));
                    }
                    BD_Industry_Code.SelectedValue = mdc_spm_IcdMustomer_1.Industry_Code_1;
                    if (!TaskAPI.IsBeginStep)
                    {
                        string Industry_Code = BD_Industry_Code.SelectedItem.Text.ToString();
                        BD_Industry_Code.Items.Clear();
                        BD_Industry_Code.Items.Add(new ListItem(Industry_Code, mdc_spm_IcdMustomer_1.Industry_Code_1));
                    }


                    BA_Industry_code_2.Text = mdc_spm_IcdMustomer_1.Industry_code_2;
                    BA_Industry_code_3.Text = mdc_spm_IcdMustomer_1.Industry_code_3;
                    BA_Tax_Number.Text = mdc_spm_IcdMustomer_1.Tax_Number_1;
                    BA_Bank_Name.Text = mdc_spm_IcdMustomer_1.Bank_Name;
                    BA_Bank_Name.Text = mdc_spm_IcdMustomer_1.Bank_account;
                    BA_Recon_account.SelectedValue = mdc_spm_IcdMustomer_1.Recon_account;
                    if (!TaskAPI.IsBeginStep)
                    {
                        string recon_account = BA_Recon_account.SelectedItem.Text.ToString();
                        BA_Recon_account.Items.Clear();
                        BA_Recon_account.Items.Add(new ListItem(recon_account, mdc_spm_IcdMustomer_1.Recon_account));

                    }
                    BA_Sort_key.Text = mdc_spm_IcdMustomer_1.Sort_key;
                    BA_Cash_mgmt_group.Text = mdc_spm_IcdMustomer_1.Cash_mgmt_group;
                    BD_Payment_Terms.SelectedValue = mdc_spm_IcdMustomer_1.Payment_Terms;
                    if (!TaskAPI.IsBeginStep)
                    {
                        string Payment_Terms = BD_Payment_Terms.SelectedItem.Text.ToString();
                        BD_Payment_Terms.Items.Clear();
                        BD_Payment_Terms.Items.Add(new ListItem(Payment_Terms, mdc_spm_IcdMustomer_1.Payment_Terms));
                    }

                    BA_Payment_history_record.Text = mdc_spm_IcdMustomer_1.Payment_history_record;
                    BA_Dunn_Procedure.Text = mdc_spm_IcdMustomer_1.Dunn_Procedure;
                    BA_Bank_statement.Text = mdc_spm_IcdMustomer_1.Bank_statement;
                    BD_Sales_Office.SelectedValue = mdc_spm_IcdMustomer_1.Sales_Office;
                    if (!TaskAPI.IsBeginStep)
                    {
                        string Sales_Office = BD_Sales_Office.SelectedItem.Text.ToString();
                        BD_Sales_Office.Items.Clear();
                        BD_Sales_Office.Items.Add(new ListItem(Sales_Office, mdc_spm_IcdMustomer_1.Sales_Office));
                    }


                    BA_Currency.Text = mdc_spm_IcdMustomer_1.Currency;
                    BA_switch_off_rounding.Text = mdc_spm_IcdMustomer_1.Switch_off_rounding;
                    BA_Price_group.Text = mdc_spm_IcdMustomer_1.Price_group;
                    BA_Cust_pric_proc.Text = mdc_spm_IcdMustomer_1.Cust_pric_proc;
                    BA_Order_probability.Text = mdc_spm_IcdMustomer_1.Order_probability;
                    BA_Order_combination.Text = mdc_spm_IcdMustomer_1.Order_combination;
                    BA_Shipping_Conditions.Text = mdc_spm_IcdMustomer_1.Shipping_Conditions;
                    BA_Relevant_for_POD.Text = mdc_spm_IcdMustomer_1.Relevant_for_POD;
                    BA_Complete_delivery_reqd_by_law.Text = mdc_spm_IcdMustomer_1.Complete_delivery_reqd_by_law;
                    BA_Partial_delivery_per_item.Text = mdc_spm_IcdMustomer_1.Partial_delivery_per_item;
                    BA_Max_partial_deliveries.Text = mdc_spm_IcdMustomer_1.Max_partial_deliveries;
                    BA_Rebate.Text = mdc_spm_IcdMustomer_1.Rebate;
                    BA_Price_detemin.Text = mdc_spm_IcdMustomer_1.Price_detemin;
                    BA_Incoterms.Text = mdc_spm_IcdMustomer_1.Incoterms;
                    BD_Terms_of_payment.SelectedValue = mdc_spm_IcdMustomer_1.Terms_of_payment;
                    if (!TaskAPI.IsBeginStep)
                    {
                        string Terms_of_payment = BD_Terms_of_payment.SelectedItem.Text.ToString();
                        BD_Terms_of_payment.Items.Clear();
                        BD_Terms_of_payment.Items.Add(new ListItem(Terms_of_payment, mdc_spm_IcdMustomer_1.Terms_of_payment));
                    }

                    BA_Acct_assgmt_group.Text = mdc_spm_IcdMustomer_1.Acct_assgmt_group;
                    BA_Tax_classification.Text = mdc_spm_IcdMustomer_1.Tax_classification;
                    BA_Tax_category_1.Text = mdc_spm_IcdMustomer_1.Tax_category_1;
                    BA_Additional_data_Customer_grp_2.Text = mdc_spm_IcdMustomer_1.Additional_data_Customer_grp_2;

                    BA_Date.Text = mdc_spm_IcdMustomer_1.Date;

                    if (!TaskAPI.IsBeginStep && TaskAPI.Step != "Finance")
                    {
                        BA_BP.SelectedValue = mdc_spm_IcdMustomer_1.Bp;
                        string Bp = BA_BP.SelectedItem.Text.ToString();
                        BA_BP.Items.Clear();
                        BA_BP.Items.Add(new ListItem(Bp, mdc_spm_IcdMustomer_1.Bp));
                    }
                    else
                    {
                        BA_BP.SelectedValue = mdc_spm_IcdMustomer_1.Bp;
                    }
                    if (!TaskAPI.IsBeginStep && TaskAPI.Step != "Finance")
                    {
                        BA_Py.SelectedValue = mdc_spm_IcdMustomer_1.Py;
                        string Py = BA_Py.SelectedItem.Text.ToString();
                        BA_Py.Items.Clear();
                        BA_Py.Items.Add(new ListItem(Py, mdc_spm_IcdMustomer_1.Py));
                    }
                    else
                    {
                        BA_Py.SelectedValue = mdc_spm_IcdMustomer_1.Py;
                    }
                    #endregion

                    #region 审批项初始化
                    switch (TaskAPI.Step)
                    {
                        case "DMO Approve":
                        case "DMO Maintain":
                        case "DMO Check":
                        case "LAM":
                        case "Finance":
                            Assessment1.Option.Add(new t_AssessmentOption("Finish", "1", true));
                            Assessment1.Option.Add(new t_AssessmentOption("Return", "2", false));
                            break;

                        case "Manager Approve":
                            Assessment1.Option.Add(new t_AssessmentOption("Approve", "1", true));
                            Assessment1.Option.Add(new t_AssessmentOption("Return", "2", false));
                            break;
                    }
                    #endregion
                }
                #endregion
                #region 设置控件禁启用
                bool flg11 = ((TaskAPI.IsBeginStep) && TaskAPI.IsAllowSubmit) ? true : false;

                Assessment1.Enable = TaskAPI.IsAllowSubmit;

                //SetEnable(flg11, Vd_Salesperson_Division_K1, Vd_Salesperson_Division_K2, Vd_Salesperson_Division_K3, Vd_Salesperson_Division_K1K2, VD_K1, VD_K2, VD_K3, VD_K1K2);
                SetEnable(TaskAPI.Step == "DMO Approve" | TaskAPI.Step == "DMO Maintain" | TaskAPI.Step == "DMO Check", DMO_DrpPriority);
                SetVisible(TaskAPI.Step == "DMO Approve" | TaskAPI.Step == "DMO Maintain" | TaskAPI.Step == "DMO Check", P_DMO);
                SetEnable(TaskAPI.Step == "DMO Maintain", SAP_Code);
                SetEnable(flg11, Vd_Creation, Vd_Deletion, Vd_Revision);
                SetVisible(TaskAPI.IsAllowSubmit, Send, Split);
                Attachment1.AllowDelete = flg11;
                Attachment1.AllowUpload = flg11;
                foreach (Control cr in this.Form.Controls)
                {
                    if (cr is TextBox)
                    {
                        TextBox tb = (TextBox)cr;
                        if (tb.ReadOnly == true)
                        {
                            string color = tb.ID.ToString() + "_L";
                            Label lb = (Label)this.Form.FindControl(color);
                            if (lb != null)
                            {
                                lb.ForeColor = System.Drawing.Color.Orange;
                            }
                        }
                        if (!flg11)
                        {
                            tb.ReadOnly = true;
                        }
                        if (tb.ReadOnly == true)
                        {
                            tb.ForeColor = System.Drawing.Color.DimGray;
                        }
                    }
                }
                if (Vd_Creation.Checked && flg11)
                {
                    SetForeColor(Color.Blue, BA_Recon_account_L, BA_Company_L, BA_Sales_Organization_L, BA_Description1_L, BA_Description_L, BA_Search_Term_L, BA_Search_Term_L_CN, BA_Street_EN_L, BA_Street_CN_L, BA_City_EN_L, BA_City_CN_L, BA_Country_L, BA_Region_L, BA_Postal_Code_L, BA_Payment_Terms_L, BA_Transportation_zone_L, BA_Terms_of_payment_L);
                }
                InitTabs();
                //UsersChoose1.MDCActions = Actions.SelectedValue;
                #endregion
            }
        }

        #endregion
        //protected override void OnLoad(EventArgs e)
        //{
        //    InitControls();
        //    base.OnLoad(e);
        //}
        #region InitControls
        public void InitControls()
        {

        }
        #endregion

        #region 事件 Send
        protected void Send_Click(object sender, EventArgs e)
        {

            try
            {
                #region 数据验证
                if ((TaskAPI.IsBeginStep || TaskAPI.Step == "DMO Approve") && TaskAPI.IsAllowSubmit) // 如果是退回的情况，不存在验证
                {
                    List<string> vald_s = new List<string>();
                    if (TaskAPI.Step == "DMO Approve")
                    {
                        vald_s.AddRange(UsersChoose1.DataValidation());
                    }
                    else
                    {
                        vald_s.AddRange(DataValidation());
                    }
                    if (vald_s.Count > 0)
                    {
                        Anthem.Manager.AddScriptForClientSideEval(string.Format("ShowMessage(\"{0}\", {1});", CombineMessage(vald_s), vald_s.Count));
                        return;
                    }

                }
                #endregion

                #region 引擎传值
                if (TaskAPI.IsBeginStep)
                {
                    if (TaskAPI.IsInitiate && TaskAPI.IsAllowSubmit)
                    {
                        ApplicationNo.Text = Util.GenerateSequence(((object[])TaskAPI["PrefixNo"])[0].ToString() + "-" + System.DateTime.Now.ToString("yyMM"), "", 4);
                        TaskAPI.UserName = UserAPI.UserName;
                        TaskAPI["ApplicationNo"] = ApplicationNo.Text;
                        TaskAPI["ApplicatorName"] = UserAPI.UserFullName;
                        TaskAPI["Applicator"] = UserAPI.UserName;
                        TaskAPI["Time"] = System.DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss");
                        TaskAPI["ApplicatorEmail"] = UserAPI.Mail;
                        TaskAPI["Department"] = UserAPI.Department;
                        TaskAPI["ServerName"] = Util.AppSettings("ServerName");
                    }

                    TaskAPI.Summary = (Vd_Creation.Checked ? Vd_Creation.Text : "") + (Vd_Deletion.Checked ? Vd_Deletion.Text : "") + (Vd_Revision.Checked ? Vd_Revision.Text : "")
                        + " / " + ApplicationNo.Text;

                    //TaskAPI["Actions"] = VD_Category.SelectedValue;
                    TaskAPI["DrpPriority"] = DrpPriority.SelectedItem.Text;
                    TaskAPI["Remark_by_Initiator"] = Assessment1.Assessment.Remark;
                    SortedList<string, string> tar = new SortedList<string, string>();
                    IList<mdc_Recipient> srcs = (mdc_Recipient.process == TaskAPI.Process
                                                  & (mdc_Recipient.distribute == "*")
                                                  & mdc_Recipient.status == 1).List<mdc_Recipient>();

                    foreach (mdc_Recipient src in srcs)
                    {
                        if (!tar.ContainsKey(src.Step))
                        {
                            tar.Add(src.Step, src.Recipient);
                            continue;
                        }

                        if (tar.Values[tar.IndexOfKey(src.Step)].Contains(src.Recipient))
                        {
                            continue;
                        }

                        tar[src.Step] = tar.Values[tar.IndexOfKey(src.Step)] + "," + src.Recipient;
                    }

                    //步骤处理人赋值
                    for (int i = 0; i < tar.Keys.Count; i++)
                    {
                        TaskAPI["R_" + tar.Keys[i].Replace(" ", "_")] = tar.Values[i].Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    }

                    m_OrgChart oc = (m_OrgChart.empID.In(m_OrgChart.supervisorEmpID, m_OrgChart.winID == UserAPI.UserName)).ListFirst<m_OrgChart>();
                    if (oc != null)
                    {
                        TaskAPI["R_Manager_Approve"] = oc.WinID;
                    }

                #endregion


                }
                else
                {
                    TaskAPI["ApproveResult"] = Assessment1.Assessment.Opinion;
                    TaskAPI["TaskID"] = TaskAPI.TaskID;
                }

                //#region 退回步骤并返回功能传值  
                //if (!string.IsNullOrEmpty(Assessment1.JumpStep))
                //{
                //    TaskAPI["Step"] = Assessment1.JumpStep;
                //    TaskAPI["PreStep"] = TaskAPI.Step;
                //}
                //else
                //{
                //    string PreStep = ((object[])TaskAPI["PreStep"])[0].ToString();
                //    if (PreStep.Trim() != "")
                //    {
                //        TaskAPI["Step"]    = PreStep;
                //        TaskAPI["PreStep"] = "";
                //    }
                //    else
                //    {
                //        TaskAPI["Step"] = "";
                //        TaskAPI["PreStep"] = "";
                //    }
                //}
                //#endregion



                #region 提交步骤
                bool flg = false;
                Storage.TransactionExecute(o =>
                {
                    #region “Fill in the form”步骤
                    if (TaskAPI.IsBeginStep || TaskAPI.Step == "Finance")
                    {
                        //将数据库里当前流程对应的  状态置为逻辑删除
                        (mdc_spm_IcdMustomer.process == TaskAPI.Process & mdc_spm_IcdMustomer.incident == TaskAPI.Incident).Edit<mdc_spm_IcdMustomer>(p =>
                        {
                            p.Status = 1;
                        }
                        );
                        mdc_spm_IcdMustomer mdc_spm_IcdMustomer_1 = new mdc_spm_IcdMustomer();
                        if ((mdc_spm_IcdMustomer.process == TaskAPI.Process & mdc_spm_IcdMustomer.incident == TaskAPI.Incident).Count<mdc_spm_IcdMustomer>() > 0)
                        {
                            mdc_spm_IcdMustomer_1 = (mdc_spm_IcdMustomer.process == TaskAPI.Process & mdc_spm_IcdMustomer.incident == TaskAPI.Incident).ListFirst<mdc_spm_IcdMustomer>();
                        }
                        else
                        {
                            mdc_spm_IcdMustomer_1.Process = TaskAPI.Process;
                            mdc_spm_IcdMustomer_1.Incident = TaskAPI.Incident;
                            mdc_spm_IcdMustomer_1.UserName = UserAPI.UserName;

                            mdc_spm_IcdMustomer_1.ApplicationNo = ApplicationNo.Text;
                            mdc_spm_IcdMustomer_1.Time = System.DateTime.Now;
                            mdc_spm_IcdMustomer_1.Status = 0;
                            mdc_spm_IcdMustomer_1.Department = UserAPI.Department;
                        }
                        if (Vd_Creation.Checked)
                        {
                            mdc_spm_IcdMustomer_1.Type = "1";
                        }
                        else if (Vd_Deletion.Checked)
                        {
                            mdc_spm_IcdMustomer_1.Type = "2";
                        }
                        else if (Vd_Revision.Checked)
                        {
                            mdc_spm_IcdMustomer_1.Type = "3";
                        }
                        mdc_spm_IcdMustomer_1.DrpPriority = DrpPriority.SelectedValue;
                        mdc_spm_IcdMustomer_1.Customer_Code = BA_Customer_Code.Text.ToString();
                        mdc_spm_IcdMustomer_1.Company = BD_Company.SelectedValue.ToString();
                        mdc_spm_IcdMustomer_1.Sales_Organization = BD_Sales_Organization.SelectedValue.ToString();
                        mdc_spm_IcdMustomer_1.Distribution_Channel = BA_Distribution_Channel.Text.ToString().Trim();
                        mdc_spm_IcdMustomer_1.Division = BA_Division.Text.Trim();
                        mdc_spm_IcdMustomer_1.Description_1 = BA_Description1.Text.Trim();
                        mdc_spm_IcdMustomer_1.Description_2 = BA_Description2.Text.Trim();
                        mdc_spm_IcdMustomer_1.Search_Term_EN = BA_Search_Term.Text.Trim();
                        mdc_spm_IcdMustomer_1.Search_Term_CN = BA_Search_Term_CN.Text.Trim();
                        mdc_spm_IcdMustomer_1.Street_EN = BA_Street_EN.Text.Trim();
                        mdc_spm_IcdMustomer_1.Street_CN = BA_Street_CN.Text.Trim();
                        mdc_spm_IcdMustomer_1.City_EN = BA_City_EN.Text.Trim();
                        mdc_spm_IcdMustomer_1.City_CN = BA_City_CN.Text.Trim();
                        mdc_spm_IcdMustomer_1.Country = BD_Country.Text.Trim();
                        mdc_spm_IcdMustomer_1.Region = BD_Region.SelectedValue.ToString();
                        mdc_spm_IcdMustomer_1.Postal_Code = BA_Postal_Code.Text.Trim();
                        mdc_spm_IcdMustomer_1.Street4 = BA_Street4.Text.Trim();
                        mdc_spm_IcdMustomer_1.Street5 = BA_Street5.Text.Trim();
                        mdc_spm_IcdMustomer_1.District = BA_District.Text.Trim();
                        mdc_spm_IcdMustomer_1.Transportation_zone = BA_Transportation_zone.Text.Trim();
                        mdc_spm_IcdMustomer_1.Language = BA_Language.Text.Trim();
                        mdc_spm_IcdMustomer_1.Contact_Person = BA_Contact_Person.Text.Trim();
                        mdc_spm_IcdMustomer_1.Telephone = BA_Telephone.Text.Trim();
                        mdc_spm_IcdMustomer_1.Ext_1 = BA_Ext.Text.Trim();
                        mdc_spm_IcdMustomer_1.Fax_number = BA_Fax_number.Text.Trim();
                        mdc_spm_IcdMustomer_1.Ext_2 = BA_Ext1.Text.Trim();
                        mdc_spm_IcdMustomer_1.Email = BA_Email.Text.Trim();
                        mdc_spm_IcdMustomer_1.Vendor = BA_Vendor.Text.Trim();
                        mdc_spm_IcdMustomer_1.Trading_Partner_1 = this.BA_Trading_Partner_1.Text.Trim();
                        mdc_spm_IcdMustomer_1.Corporate_Group = BA_Corporate_Group.Text.Trim();
                        mdc_spm_IcdMustomer_1.Industry = BD_Industry.SelectedValue.ToString();
                        mdc_spm_IcdMustomer_1.County_code = BD_County_code.SelectedValue.ToString();
                        mdc_spm_IcdMustomer_1.City_code = BD_City_code.SelectedValue.ToString();
                        mdc_spm_IcdMustomer_1.Industry_Code_1 = BD_Industry_Code.SelectedValue.ToString();
                        mdc_spm_IcdMustomer_1.Industry_code_2 = BA_Industry_code_2.Text.Trim();
                        mdc_spm_IcdMustomer_1.Industry_code_3 = BA_Industry_code_3.Text.Trim();
                        mdc_spm_IcdMustomer_1.Tax_Number_1 = BA_Tax_Number.Text.Trim();
                        mdc_spm_IcdMustomer_1.Bank_Name = BA_Bank_Name.Text.Trim();
                        mdc_spm_IcdMustomer_1.Bank_account = BA_Bank_Name.Text.Trim();
                        mdc_spm_IcdMustomer_1.Recon_account = BA_Recon_account.SelectedValue.ToString();
                        mdc_spm_IcdMustomer_1.Sort_key = BA_Sort_key.Text.Trim();
                        mdc_spm_IcdMustomer_1.Cash_mgmt_group = BA_Cash_mgmt_group.Text.Trim();
                        mdc_spm_IcdMustomer_1.Payment_Terms = BD_Payment_Terms.SelectedValue.ToString();
                        mdc_spm_IcdMustomer_1.Payment_history_record = BA_Payment_history_record.Text.Trim();
                        mdc_spm_IcdMustomer_1.Dunn_Procedure = BA_Dunn_Procedure.Text.Trim();
                        mdc_spm_IcdMustomer_1.Bank_statement = BA_Bank_statement.Text.Trim();
                        mdc_spm_IcdMustomer_1.Sales_Office = BD_Sales_Office.SelectedValue.ToString();
                        mdc_spm_IcdMustomer_1.Currency = BA_Currency.Text.Trim();
                        mdc_spm_IcdMustomer_1.Switch_off_rounding = BA_switch_off_rounding.Text.Trim();
                        mdc_spm_IcdMustomer_1.Price_group = BA_Price_group.Text.Trim();
                        mdc_spm_IcdMustomer_1.Cust_pric_proc = BA_Cust_pric_proc.Text.Trim();
                        mdc_spm_IcdMustomer_1.Order_probability = BA_Order_probability.Text.Trim();
                        mdc_spm_IcdMustomer_1.Order_combination = BA_Order_combination.Text.Trim();
                        mdc_spm_IcdMustomer_1.Shipping_Conditions = BA_Shipping_Conditions.Text.Trim();
                        mdc_spm_IcdMustomer_1.Relevant_for_POD = BA_Relevant_for_POD.Text.Trim();
                        mdc_spm_IcdMustomer_1.Complete_delivery_reqd_by_law = BA_Complete_delivery_reqd_by_law.Text.Trim();
                        mdc_spm_IcdMustomer_1.Partial_delivery_per_item = BA_Partial_delivery_per_item.Text.Trim();
                        mdc_spm_IcdMustomer_1.Max_partial_deliveries = BA_Max_partial_deliveries.Text.Trim();
                        mdc_spm_IcdMustomer_1.Rebate = BA_Rebate.Text.Trim();
                        mdc_spm_IcdMustomer_1.Price_detemin = BA_Price_detemin.Text.Trim();
                        mdc_spm_IcdMustomer_1.Incoterms = BA_Incoterms.Text.Trim();
                        mdc_spm_IcdMustomer_1.Terms_of_payment = BD_Terms_of_payment.Text.Trim();
                        mdc_spm_IcdMustomer_1.Acct_assgmt_group = BA_Acct_assgmt_group.Text.Trim();
                        mdc_spm_IcdMustomer_1.Tax_classification = BA_Tax_classification.Text.Trim();
                        mdc_spm_IcdMustomer_1.Tax_category_1 = BA_Tax_category_1.Text.Trim();
                        mdc_spm_IcdMustomer_1.Additional_data_Customer_grp_2 = BA_Additional_data_Customer_grp_2.Text.Trim();
                        mdc_spm_IcdMustomer_1.Date = this.BA_Date.Text;

                        mdc_spm_IcdMustomer_1.Bp = BA_BP.SelectedValue;
                        mdc_spm_IcdMustomer_1.Py = BA_Py.SelectedValue;

                        (t_Attachment.process == TaskAPI.Process & t_Attachment.incident == 0 & t_Attachment.username == UserAPI.UserName).Edit<t_Attachment>(p =>
                        {
                            p.Incident = TaskAPI.Incident;
                        });
                        UsersChoose1.SaveStatus(Assessment1.Assessment.Opinion == "1" ? "1" : "0");
                        Storage.Save(Storage.Context1, mdc_spm_IcdMustomer_1);
                    }
                    #endregion

                    // Save();
                    #region Priority功能
                    if (TaskAPI.IsBeginStep && !string.IsNullOrEmpty(DrpPriority.SelectedValue))
                    {
                        mdc_Priority pro;
                        if ((mdc_Priority.process == TaskAPI.Process & mdc_Priority.incident == TaskAPI.Incident).Count<mdc_Priority>() > 0)
                        {
                            pro = new mdc_Priority();
                            pro = (mdc_Priority.process == TaskAPI.Process & mdc_Priority.incident == TaskAPI.Incident).ListFirst<mdc_Priority>();
                            pro.Business_Priority = Convert.ToInt32(DrpPriority.SelectedValue);
                            Storage.Save(pro);
                        }
                        else
                        {
                            pro = new mdc_Priority();
                            pro.Process = TaskAPI.Process;
                            pro.Incident = TaskAPI.Incident;
                            pro.Business_Priority = Convert.ToInt32(DrpPriority.SelectedValue);
                            Storage.Save(pro);
                        }

                    }


                    if ((TaskAPI.Step == "DMO Maintain" || TaskAPI.Step == "DMO Approve" || TaskAPI.Step == "DMO Check") && !string.IsNullOrEmpty(this.DMO_DrpPriority.SelectedValue) && !string.IsNullOrEmpty(DrpPriority.SelectedValue))
                    {

                        //mdc_Priority pro;
                        //pro = (mdc_Priority.process == TaskAPI.Process & mdc_Priority.incident == TaskAPI.Incident).ListFirst<mdc_Priority>();
                        //pro.DMO_Priority = Convert.ToInt32(DMO_DrpPriority.SelectedValue);
                        //Storage.Save(pro);
                        mdc_Priority pro;
                        if ((mdc_Priority.process == TaskAPI.Process & mdc_Priority.incident == TaskAPI.Incident).Count<mdc_Priority>() > 0)
                        {
                            pro = (mdc_Priority.process == TaskAPI.Process & mdc_Priority.incident == TaskAPI.Incident).ListFirst<mdc_Priority>();
                            pro.DMO_Priority = Convert.ToInt32(DMO_DrpPriority.SelectedValue);
                            Storage.Save(pro);
                        }
                        else
                        {
                            pro = (mdc_Priority.process == TaskAPI.Process & mdc_Priority.incident == TaskAPI.Incident).ListFirst<mdc_Priority>();
                            pro.DMO_Priority = Convert.ToInt32(DMO_DrpPriority.SelectedValue);
                            Storage.Save(pro);
                        }


                    }
                    #endregion
                    #region “DMO Maintain”步骤
                    if (TaskAPI.Step == "DMO Maintain" || TaskAPI.Step == "DMO Approve" || TaskAPI.Step == "DMO Check")
                    {

                        TaskAPI["DMO_DrpPriority"] = DMO_DrpPriority.SelectedItem.Text;
                        (mdc_spm_IcdMustomer.process == TaskAPI.Process & mdc_spm_IcdMustomer.incident == TaskAPI.Incident).Edit<mdc_spm_IcdMustomer>(p =>
                        {
                            // p.SAP_Code = SAP_Code.Text;
                            p.DMO_DrpPriority = DMO_DrpPriority.SelectedValue;

                        }
                        );
                    }
                    #endregion
                    //UsersChoose1.SaveStatus(Assessment1.Assessment.Opinion == "1" ? "1" : "0");
                    Storage.Save(Assessment1.Assessment);    //审批意见
                    #region 退回步骤并返回功能 传值
                    if (TaskAPI["R_" + TaskAPI.Step.Replace(" ", "_").Replace("/", "_")] != null)
                    {
                        object[] obj = (object[])(TaskAPI["R_" + TaskAPI.Step.Replace(" ", "_").Replace("/", "_")]);
                        for (int i = 0; i < obj.GetUpperBound(0); i++)
                        {
                            obj[i] = null;
                        }
                        obj[0] = UserAPI.UserName;
                        TaskAPI["R_" + TaskAPI.Step.Replace(" ", "_")] = obj;
                    }
                    //多节点退回
                    if (!string.IsNullOrEmpty(Assessment1.JumpStep))
                    {
                        Assessment1.SetAsReturn(true);
                        TaskAPI.DirectActive(Assessment1.JumpStep);
                    }
                    else
                    {
                        Assessment1.SetAsReturn(false);
                    }
                    Assessment1.SubmitTo();
                    #endregion
                    flg = TaskAPI.Send();
                });

                //如果数据库写入成功且流程发起成功的情况，将业务表数据与流程实例号进行关联
                if (TaskAPI.IsInitiate)
                {
                    if (!string.IsNullOrEmpty(DrpPriority.SelectedValue))
                    {
                        (mdc_Priority.process == TaskAPI.Process & mdc_Priority.incident == 0).Edit<mdc_Priority>(p =>
                        {
                            p.Incident = TaskAPI.Incident;
                        });
                    }

                    (mdc_spm_IcdMustomer.process == TaskAPI.Process & mdc_spm_IcdMustomer.incident == 0 & mdc_spm_IcdMustomer.userName == UserAPI.UserName).Edit<mdc_spm_IcdMustomer>(p =>
                    {
                        p.Incident = TaskAPI.Incident;
                    });
                    (t_Assessment.process == TaskAPI.Process & t_Assessment.incident == 0 & t_Assessment.userName == UserAPI.UserName).Edit<t_Assessment>(p =>
                    {
                        p.Incident = TaskAPI.Incident;
                    });

                    (t_Attachment.process == TaskAPI.Process & t_Attachment.incident == 0 & t_Attachment.username == UserAPI.UserName).Edit<t_Attachment>(p =>
                    {
                        p.Incident = TaskAPI.Incident;
                    });


                }
                #endregion

                Send.Visible = false;
                Anthem.Manager.AddScriptForClientSideEval("JSInfomation('" + Resources.Global.C_00_Success + "',true)");
            }
            catch (Exception ex)
            {
                TaskDB.Log("", false, "调用NVA方法Send_Click出错：" + ex.ToString());
                Anthem.Manager.AddScriptForClientSideEval("JSInfomation('" + Resources.Global.C_00_Failed + "',false)");
            }

        }
        #endregion

        #region 事件 CheckedChanged
        protected void Vd_Check_CheckedChanged(object sender, EventArgs e)
        {
        }
        #endregion

        #region 事件 Category变换
        protected void VD_Category_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
        #endregion
        #region 事件 Sales_Office变换
        protected void VD_Sales_Office_SelectedIndexChanged(object sender, EventArgs e)
        {
        }
        #endregion
        #region 事件 VD_Region变换
        protected void VD_Region_SelectedIndexChanged(object sender, EventArgs e)
        {
        }
        #endregion
        #region 事件 Tabs切换
        protected void Tabs_Click(object sender, EventArgs e)
        {
            if (((LinkButton)sender).CssClass == "tabs2")
            {
                return;
            }


        }
        #endregion

        #region 方法 初始化Tabs
        protected void InitTabs()
        {
        }
        #endregion

        #region 方法 InitDropdownList
        private void InitDropDownList()
        {
            if (!IsLoaded)
            {
                #region VD_Region()
                BD_Region.Items.Clear();
                BD_Region.Items.Add(new ListItem("", ""));
                IList<m_Region_SalesOffice> m_rs = (m_Region_SalesOffice.status == 1).List<m_Region_SalesOffice>();
                foreach (m_Region_SalesOffice RS in m_rs)
                {
                    BD_Region.Items.Add(new ListItem(RS.Region.ToString().Substring(3, RS.Region.Length - 3), RS.Region.ToString().Substring(3, RS.Region.Length - 3)));
                }
                #endregion
                #region Sales Office(Sold to)
                BD_Sales_Office.Items.Clear();
                BD_Sales_Office.Items.Add(new ListItem("", ""));
                IList<m_Sales_Office1> bsos = (m_Sales_Office1.status == 1).List<m_Sales_Office1>();
                foreach (m_Sales_Office1 BSO in bsos)
                {
                    BD_Sales_Office.Items.Add(new ListItem(BSO.Sales_Office1, BSO.Sales_Office1));
                }
                #endregion
                #region  BD_Sales_Organization
                BD_Sales_Organization.Items.Clear();
                BD_Sales_Organization.Items.Add(new ListItem("", ""));
                BD_Sales_Organization.Items.Add(new ListItem("CN88 4119-SH", "CN88"));
                BD_Sales_Organization.Items.Add(new ListItem("CN02 4118-GZ", "CN02"));
                BD_Sales_Organization.Items.Add(new ListItem("CN03 1718-LF", "CN03"));
                BD_Sales_Organization.Items.Add(new ListItem("CN04 Hongkong", "CN04"));
                BD_Sales_Organization.Items.Add(new ListItem("CN05 8118 Shanghai-GZBR", "CN05"));
                BD_Sales_Organization.Items.Add(new ListItem("CN06 8718 Shanghai-LFBR", "CN06"));
                BD_Sales_Organization.Items.Add(new ListItem("CN88/CN02/CN03/CN04/CN05/CN06", "CN88/CN02/CN03/CN04/CN05/CN06"));
                #endregion
                #region BD_Industry
                BD_Industry.Items.Clear();
                BD_Industry.Items.Add(new ListItem("", ""));
                IList<m_Industry_Code> industry = (m_Industry_Code.status == 1).List<m_Industry_Code>();
                foreach (m_Industry_Code mic in industry)
                {
                    BD_Industry.Items.Add(new ListItem(mic.Explanation, mic.Industry_Code));
                }
                #endregion
                #region   BD_County_code
                BD_County_code.Items.Clear();
                BD_County_code.Items.Add(new ListItem("", ""));
                BD_County_code.Items.Add(new ListItem("K01 A级城市", "K01"));
                BD_County_code.Items.Add(new ListItem("K02 B级城市", "K02"));
                BD_County_code.Items.Add(new ListItem("K03 C级城市", "K03"));
                BD_County_code.Items.Add(new ListItem("K04 D级城市", "K04"));
                #endregion
                #region BD_Industry_Code
                BD_Industry_Code.Items.Clear();
                BD_Industry_Code.Items.Add(new ListItem("", ""));
                IList<m_Industry_Code1> industry1 = (m_Industry_Code1.status == 1).List<m_Industry_Code1>();
                foreach (m_Industry_Code1 mic1 in industry1)
                {
                    BD_Industry_Code.Items.Add(new ListItem(mic1.Explanation, mic1.Industry_Code_1));
                }
                #endregion
                #region
                BD_City_code.Items.Clear();
                BD_City_code.Items.Add(new ListItem("", ""));
                IList<m_Sales_Office> mso = (m_Sales_Office.status == 1).List<m_Sales_Office>();
                foreach (m_Sales_Office MSO in mso)
                {
                    BD_City_code.Items.Add(new ListItem(MSO.City_Code_Name, MSO.City_Code));
                }
                #endregion
                #region  BD_Payment_Terms
                BD_Payment_Terms.Items.Clear();
                BD_Payment_Terms.Items.Add(new ListItem("", ""));
                IList<mdc_spm_Icd_Payment_Terms> ipt = (mdc_spm_Icd_Payment_Terms.status == 1).List<mdc_spm_Icd_Payment_Terms>();
                foreach (mdc_spm_Icd_Payment_Terms IPT in ipt)
                {
                    BD_Payment_Terms.Items.Add(new ListItem(IPT.Code + " " + IPT.Baseline_Date, IPT.Code));
                }
                #endregion
                #region  BD_Terms_of_payment
                BD_Terms_of_payment.Items.Clear();
                BD_Terms_of_payment.Items.Add(new ListItem("", ""));
                IList<mdc_spm_Icd_Payment_Terms> ipts = (mdc_spm_Icd_Payment_Terms.status == 1).List<mdc_spm_Icd_Payment_Terms>();
                foreach (mdc_spm_Icd_Payment_Terms IPTS in ipts)
                {
                    BD_Terms_of_payment.Items.Add(new ListItem(IPTS.Code + " " + IPTS.Baseline_Date, IPTS.Code));
                }
                #endregion

                #region  BA_Bp
                this.BA_BP.Items.Clear();
                BA_BP.Items.Add(new ListItem("", ""));
                IList<m_Bp> bp = (m_Bp.status == 1).List<m_Bp>();
                foreach (m_Bp bps in bp)
                {
                    BA_BP.Items.Add(new ListItem(bps.BP_ID + " " + bps.BP_Description, bps.BP_ID));
                }
                #endregion
                #region  BA_Py
                BA_Py.Items.Clear();
                BA_Py.Items.Add(new ListItem("", ""));
                IList<m_Py> py = (m_Bp.status == 1).List<m_Py>();
                foreach (m_Py pys in py)
                {
                    BA_Py.Items.Add(new ListItem(pys.PY_ID + " " + pys.PY_Description, pys.PY_ID));
                }
                #endregion
            }
        }
        #endregion

        #region 事件 CheckBox-必填
        protected void Vd_CheckedChanged(object sender, EventArgs e)
        {
            switch (((CheckBox)sender).ClientID)
            {
                case "Vd_Creation":
                    if (Vd_Creation.Checked)
                    {
                        Vd_Revision.Checked = false;
                        Vd_Deletion.Checked = false;
                        SetForeColor(Color.Blue, BA_Customer_Code_L, BA_Company_L, BA_Sales_Organization_L, BA_Description1_L, BA_Description_L, BA_Search_Term_L, BA_Search_Term_L_CN, BA_Street_EN_L, BA_Street_CN_L, BA_City_EN_L, BA_City_CN_L, BA_Country_L, BA_Region_L, BA_Postal_Code_L, BA_Payment_Terms_L, BA_Transportation_zone_L, BA_Terms_of_payment_L);
                        SetForeColor(Color.Black, BA_Customer_Code_L);
                    }
                    else
                    {
                        Vd_Creation.Checked = true;
                    }
                    break;
                case "Vd_Revision":
                    if (Vd_Revision.Checked)
                    {
                        Vd_Deletion.Checked = false;
                        Vd_Creation.Checked = false;
                        SetForeColor(Color.Blue, BA_Customer_Code_L, BA_Company_L, BA_Sales_Organization_L, BA_Description1_L, BA_Description_L);
                        SetForeColor(Color.Black, BA_Search_Term_L, BA_Search_Term_L_CN, BA_Street_EN_L, BA_Street_CN_L, BA_City_EN_L, BA_City_CN_L, BA_Country_L, BA_Region_L, BA_Postal_Code_L, BA_Payment_Terms_L, BA_Transportation_zone_L, BA_Terms_of_payment_L);
                    }
                    else
                    {
                        Vd_Revision.Checked = true;
                    }
                    break;
                case "Vd_Deletion":
                    if (Vd_Deletion.Checked)
                    {
                        Vd_Revision.Checked = false;
                        Vd_Creation.Checked = false;
                        SetForeColor(Color.Blue, BA_Customer_Code_L, BA_Company_L, BA_Sales_Organization_L, BA_Description1_L, BA_Description_L);
                        SetForeColor(Color.Black, BA_Search_Term_L, BA_Search_Term_L_CN, BA_Street_EN_L, BA_Street_CN_L, BA_City_EN_L, BA_City_CN_L, BA_Country_L, BA_Region_L, BA_Postal_Code_L, BA_Payment_Terms_L, BA_Transportation_zone_L, BA_Terms_of_payment_L);
                    }
                    else
                    {
                        Vd_Deletion.Checked = true;
                    }
                    break;
            }

        }
        #endregion
        #region 方法 数据验证
        private List<string> DataValidation()
        {
            #region
            List<Regular> regs = new List<Regular>();
            //SetForeColor(Color.Blue);
            if (!Vd_Revision.Checked && !Vd_Creation.Checked && !Vd_Deletion.Checked)
            {
                regs.Add(new Regular(RegularExp.NotEmpty, ("").Trim(), "&nbsp;&nbsp; 类型  Type 必填"));
            }
            if (Vd_Deletion.Checked || Vd_Revision.Checked || Vd_Creation.Checked)
            {
                if (!Vd_Creation.Checked)
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, (BA_Customer_Code.Text.ToString() + "").Trim(), "&nbsp;&nbsp;   Customer_Code 必填"));
                }
                regs.Add(new Regular(RegularExp.NotEmpty, (BD_Company.SelectedItem.Text.ToString() + "").Trim(), "&nbsp;&nbsp; 类型  Company 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BD_Sales_Organization.SelectedItem.Text.ToString() + "").Trim(), "&nbsp;&nbsp;    Sales_Organization 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BA_Description1.Text.ToString() + "").Trim(), "&nbsp;&nbsp;    Description1 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BA_Description2.Text.ToString() + "").Trim(), "&nbsp;&nbsp;    Description2 必填"));
            }
            if (Vd_Creation.Checked)
            {
                regs.Add(new Regular(RegularExp.NotEmpty, (BA_Recon_account.SelectedItem.Text.ToString() + "").Trim(), "&nbsp;&nbsp;    Recon account 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BA_Search_Term.Text.ToString() + "").Trim(), "&nbsp;&nbsp;     Search_Term 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BA_Search_Term_CN.Text.ToString() + "").Trim(), "&nbsp;&nbsp;     Search_Term_CN 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BA_Street_EN.Text.ToString() + "").Trim(), "&nbsp;&nbsp;     Street_EN 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BA_Street_CN.Text.ToString() + "").Trim(), "&nbsp;&nbsp;     Street_CN 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BA_City_EN.Text.ToString() + "").Trim(), "&nbsp;&nbsp;     City_EN 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BA_City_CN.Text.ToString() + "").Trim(), "&nbsp;&nbsp;     City_CN 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BD_Country.Text.ToString() + "").Trim(), "&nbsp;&nbsp;    Country 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BD_Region.SelectedItem.Text.ToString() + "").Trim(), "&nbsp;&nbsp;    Region 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BA_Postal_Code.Text.ToString() + "").Trim(), "&nbsp;&nbsp;     Postal_Code 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BD_Payment_Terms.SelectedItem.Text.ToString() + "").Trim(), "&nbsp;&nbsp;    Payment_Terms 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BA_Transportation_zone.Text.ToString() + "").Trim(), "&nbsp;&nbsp;     Transportation_zone 必填"));
                regs.Add(new Regular(RegularExp.NotEmpty, (BD_Terms_of_payment.SelectedItem.Text.ToString() + "").Trim(), "&nbsp;&nbsp;    Terms_of_payment 必填"));
            }
            #endregion



            return Validation(regs);
        }
        #endregion

        #region 方法 Others
        protected void VD_Payment_Methods_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
        private string getFormCheckList(Anthem.CheckBoxList ck)
        {
            string t = "";
            for (int i = 0; i < ck.Items.Count; i++)
                if (ck.Items[i].Selected)
                    t += "," + ck.Items[i].Value;
                else
                    t += ",";
            return t;
        }
        private Anthem.CheckBoxList setCheckList(string t, Anthem.CheckBoxList ck)
        {
            try
            {
                string[] tt = t.Split(',');

                for (int i = 0; i <= tt.GetUpperBound(0); i++)
                {
                    for (int j = 0; j < ck.Items.Count; j++)
                    {
                        if (ck.Items[j].Value == tt[i].ToString())
                        { ck.Items[j].Selected = true; break; }
                    }
                }
            }
            catch { }
            return ck;
        }
        #endregion


    }
}